﻿NAMFox.ns(function() { with (NAMFox) {

name("URL Encoder Tests");

//////////////////////////////////////////////
// Helpers
//////////////////////////////////////////////

var tests = [
    { input: " `!@#$%^&*()+,/:;=?", expected: "+`%21@%23%24%25^%26%2a%28%29%2b%2c%2f%3a%3b%3d%3f" },
    { input: "€,Š,", expected: "%e2%82%ac%2c%c5%a0%2c" },
    { input: "₩₪", expected: "%e2%82%a9%e2%82%aa" },
    { input: "かみかぜ", expected: "%e3%81%8b%e3%81%bf%e3%81%8b%e3%81%9c" },
    { input: "one+two+three", expected: "one%2btwo%2bthree" },
    { input: "\r\n", expected: "%0d%0a" },
    { input: "\n", expected: "%0d%0a" }
];

//////////////////////////////////////////////
// Test Cases
//////////////////////////////////////////////

test("URL Encoder tests", function() {
    for (var i = 0; i < tests.length; ++i) {
        var testCase = tests[i];
        equals(testCase.expected, $.urlEncode(testCase.input), "The expected output and actual output should match.");
    }
});

}});